package com.qidian.mes.machine.controller;

import com.qidian.common.pojo.MESResult;
import com.qidian.mes.machine.service.MachineMaintainPlanService;
import com.qidian.mes.pojo.MaintainPlan;
import com.sun.tools.javac.Main;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Author 任超
 * Time 2024/10/18 16:19
 */
@RestController
@RequestMapping("/plan")
@CrossOrigin
public class MachineMaintainPlanController {

    @Autowired
    private MachineMaintainPlanService machineMaintainPlanService;

    @GetMapping("/list")
    public MESResult list(MaintainPlan maintainPlan, @RequestParam(defaultValue = "1")int page, @RequestParam(defaultValue = "10")int limit) {
        return machineMaintainPlanService.selectList(maintainPlan,page,limit);
    }

    @PutMapping("/add")
    public MESResult addPlan(@RequestBody MaintainPlan maintainPlan){
        return machineMaintainPlanService.addPlan(maintainPlan);
    }

    @PutMapping("/updatePlan")
    public MESResult updatePlan(@RequestBody MaintainPlan maintainPlan){
        return machineMaintainPlanService.updatePlan(maintainPlan);
    }

    @GetMapping("/selectById")
    public MESResult selectById(Long planId){
        return machineMaintainPlanService.selectById(planId);
    }

    @PutMapping("/updatePlanStatus")
    public MESResult updatePlanStatus(Long planId){
        return machineMaintainPlanService.updatePlanStatus(planId);
    }
}
